﻿using System.Collections.ObjectModel;

namespace EMall.Cache
{
    public class CacheKeyCollection<TKey> : Collection<TKey>
    {
        public bool TryAdd(TKey key)
        { 
            if (!base.Contains(key))
            {
                Add(key);
                return true;
            }
            return false;
        }
        public void TryAddRange(IEnumerable<TKey> keys)
        {
            foreach (var key in keys)
            {
                if (!base.Contains(key))
                {
                    Add(key);
                }
            }
        }
    }
}
